package com.service;

import com.mapper.CartMapper;
import com.model.Cart;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CartService {
    @Autowired
    private CartMapper cartMapper;

    public List<Cart> getCartList(){
        return cartMapper.getCartList();
    }

    public List<Cart> getCartByUserId(Long id){
        return cartMapper.getCartById(id);
    }

    public boolean addCartItem(Long userid,Long itemid,int quantity){
        return cartMapper.addCartItem(userid,itemid,quantity);
    }

    public boolean deleteCartItem(Long CartId){
        return cartMapper.deleteCartItem(CartId);
    }
}
